package com.zpark.mapper;

import com.zpark.pojo.Person;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @PackageName: com.zpark.mapper
 * @ClassName: IPersonMapper
 * @Description:
 * @author: RZS
 * @date: 2024/3/14  17:27
 */
public interface IPersonMapper {

    // 查询所有用户数据
    @Select("select id, username, password from person")
    List<Person> selectAll();

    // 根据用户名字查询用户数据
    @Select("select id, username, password from person where username=#{uname}")
    Person selectByUsername(String uname);

    // 根据id删除数据
    @Delete("delete from person where id=#{id}")
    Integer deleteById(Integer id);

    // 根据id修改用户数据
    @Update("update person set username=#{uname}, password=#{pwd} where id=#{id}")
    Integer updateById(Integer id, String uname, String pwd);

}
